package cn.zero.exception;

import cn.zero.enums.GlobalExceptionCode;
import lombok.Data;

@Data
public class GlobalCustomException extends RuntimeException{

    //返回代码
    private String errorcode;
    //返回消息
    private String errormessage;

    public GlobalCustomException() {}

    public GlobalCustomException(String message) {
        super(message);
    }

    //自定义有参
    public GlobalCustomException(String errormessage,String errorcode) {
        super(errormessage);
        this.errormessage = errormessage;
        this.errorcode = errorcode;
    }
    public GlobalCustomException(GlobalExceptionCode globalExceptionCode) {
        super(globalExceptionCode.getMessage());
        this.errormessage = globalExceptionCode.getMessage();
        this.errorcode = globalExceptionCode.getCloud();
    }

}
